<?php
// Location: system/core/classes/database.class.php

class database {
  // Variables
  private $variables;
  
  // Functions
  function database() {
    $this->variables['type'] = "mysql";
    $this->variables['server'] = "localhost";
    $this->variables['username'] = "<username>";
    $this->variables['password'] = "<password>";
    $this->variables['database'] = "<database>";
    
    switch ($this->variables['type']) {
      case "mysql":
        $this->variables['connection'] = mysql_connect($this->variables['server'], $this->variables['username'], $this->variables['password']) or die('Class: database - Unable to connect to server');
        mysql_select_db($this->variables['database'], $this->variables['connection']) or die('Class: database - Unabled to connect to database');
      break;
      default:
        return false;
      break;
    }
  }
  function query($sql) {
    switch ($this->variables['type']) {
      case "mysql":
        $query = mysql_query($sql, $this->variables['connection']) or die('Class: database - Unable to perform query');
        return $query;
      break;
      default:
        return false;
      break;
    }
  }
}
$system['classes']['database'] = new database();

?>
